<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FEUP-Defender: Video-Text</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Gerado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="modules.html"><span>Módulos</span></a></li>
      <li><a href="annotated.html"><span>Estruturas&nbsp;de&nbsp;dados</span></a></li>
      <li><a href="files.html"><span>Ficheiros</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Video-Text</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Usefull functions</h2></td></tr>
<tr><td colspan="2"><p><a class="anchor" id="amgrpc1a8ddfe14477d59fa213a4623a678bb"></a> </p>
<br/><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___user_types.html#ga718b4eb2652c286f4d42dc18a8e71a1a">ulong</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga5876c9f47ae08936a6634ecf22e09ea9">calcMemPosition</a> (int x, int y)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf84d8188b4820f9535fcfe8d970e2838"></a><!-- doxytag: member="VideoText::getCharAt" ref="gaf84d8188b4820f9535fcfe8d970e2838" args="(int x, int y)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>getCharAt</b> (int x, int y)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga46332f39e1e5b8dd850f8e379f10ba1d"></a><!-- doxytag: member="VideoText::getAttributesAt" ref="ga46332f39e1e5b8dd850f8e379f10ba1d" args="(int x, int y)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>getAttributesAt</b> (int x, int y)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a> (char ch, int x, int y, char attributes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gae79b53b8b2666d7d50cb6b1b8b10e677"></a><!-- doxytag: member="VideoText::printLineAt" ref="gae79b53b8b2666d7d50cb6b1b8b10e677" args="(char ch, int xi, int yi, int xf, int yf, char attributes)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>printLineAt</b> (char ch, int xi, int yi, int xf, int yf, char attributes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga0313826471a670c22f918e8f2321ed42">printStringAt</a> (char *str, int x, int y, char attributes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga4cd78efdaa310697b6e14cdee164f400"></a><!-- doxytag: member="VideoText::printSizedStringAt" ref="ga4cd78efdaa310697b6e14cdee164f400" args="(char *str, int n_char, int x, int y, char attributes)" -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><b>printSizedStringAt</b> (char *str, int n_char, int x, int y, char attributes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga5077f8c181f7342c6bb640c65b4977a2">fillScreen</a> (char background)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga6a34b0b18d5e443e272a66262d15bb1a">printIntAt</a> (int num, int x, int y, char attributes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gaf265e000b8df8f8ef7fc11b782a7c0ed">drawFrame</a> (char *title, char attributes, int x, int y, int width, int height)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga567e3669990f4c2f44549253c9bc0d6a"></a><!-- doxytag: member="VideoText::drawTable" ref="ga567e3669990f4c2f44549253c9bc0d6a" args="(char attributes, int x, int y, int n_lin, int n_col)" -->
<a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a>&nbsp;</td><td class="memItemRight" valign="bottom"><b>drawTable</b> (char attributes, int x, int y, int n_lin, int n_col)</td></tr>
<tr><td colspan="2"><h2>Screen and video memory definitions in text mode</h2></td></tr>
<tr><td colspan="2"><p><a class="anchor" id="amgrpde283e0ecf193292c6802d7683994226"></a> </p>
<br/><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga68707f77202e77a891e4f56e1f9b0219"></a><!-- doxytag: member="VideoText::VIDEO_TEXT" ref="ga68707f77202e77a891e4f56e1f9b0219" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga68707f77202e77a891e4f56e1f9b0219">VIDEO_TEXT</a>&nbsp;&nbsp;&nbsp;0xB8000</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Video address in text mode. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga241aeeb764887ae5e3de58b98f04b16d"></a><!-- doxytag: member="VideoText::WIDTH" ref="ga241aeeb764887ae5e3de58b98f04b16d" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga241aeeb764887ae5e3de58b98f04b16d">WIDTH</a>&nbsp;&nbsp;&nbsp;80</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Number of columns. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaed89bd71aee8be823e8a20ec4e093c1e"></a><!-- doxytag: member="VideoText::HEIGHT" ref="gaed89bd71aee8be823e8a20ec4e093c1e" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gaed89bd71aee8be823e8a20ec4e093c1e">HEIGHT</a>&nbsp;&nbsp;&nbsp;25</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Number of rows. <br/></td></tr>
<tr><td colspan="2"><h2>Bit meaning in attribute byte</h2></td></tr>
<tr><td colspan="2"><p><a class="anchor" id="amgrpa6083135d7f78e4556dc20b0e06144aa"></a> (see color definitions in system header file conio.h) </p>
<br/><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf033cdad58c0882be7d5f4f6e8e51cc5"></a><!-- doxytag: member="VideoText::BLUE_FOREG" ref="gaf033cdad58c0882be7d5f4f6e8e51cc5" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gaf033cdad58c0882be7d5f4f6e8e51cc5">BLUE_FOREG</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Foreground blue bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga6930edb189b477929f9860eb18f9eb28"></a><!-- doxytag: member="VideoText::GREEN_FOREG" ref="ga6930edb189b477929f9860eb18f9eb28" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga6930edb189b477929f9860eb18f9eb28">GREEN_FOREG</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Foreground green bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gafdb9aad619ebc55ef35dbca7d3d29f67"></a><!-- doxytag: member="VideoText::RED_FOREG" ref="gafdb9aad619ebc55ef35dbca7d3d29f67" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gafdb9aad619ebc55ef35dbca7d3d29f67">RED_FOREG</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Foreground red bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaefba0529f534f0403d79db250c5e266f"></a><!-- doxytag: member="VideoText::STRONG" ref="gaefba0529f534f0403d79db250c5e266f" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gaefba0529f534f0403d79db250c5e266f">STRONG</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 3)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Foreground intensity bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga38779351433b604698f05e98c6c85f3c"></a><!-- doxytag: member="VideoText::BLUE_BACK" ref="ga38779351433b604698f05e98c6c85f3c" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga38779351433b604698f05e98c6c85f3c">BLUE_BACK</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 4)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Background blue bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga8d30d8ed6e3aa0e1ed94a55d10098668"></a><!-- doxytag: member="VideoText::GREEN_BACK" ref="ga8d30d8ed6e3aa0e1ed94a55d10098668" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga8d30d8ed6e3aa0e1ed94a55d10098668">GREEN_BACK</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 5)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Background gren bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaba6c0183ebb09921a6cbb31fd143310b"></a><!-- doxytag: member="VideoText::RED_BACK" ref="gaba6c0183ebb09921a6cbb31fd143310b" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#gaba6c0183ebb09921a6cbb31fd143310b">RED_BACK</a>&nbsp;&nbsp;&nbsp;(1 &lt;&lt; 6)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Background red bit. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaa0852016db20e3d95e89c9cfe06d77e5"></a><!-- doxytag: member="VideoText::AQUA_BACK" ref="gaa0852016db20e3d95e89c9cfe06d77e5" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>AQUA_BACK</b>&nbsp;&nbsp;&nbsp;(BLUE_BACK | GREEN_BACK)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga4276746c320d3e5290ef1ee3d3f5c83d"></a><!-- doxytag: member="VideoText::PURPLE_BACK" ref="ga4276746c320d3e5290ef1ee3d3f5c83d" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>PURPLE_BACK</b>&nbsp;&nbsp;&nbsp;(BLUE_BACK | RED_BACK)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga1fd19b5b07308b98224e33d2b15ad168"></a><!-- doxytag: member="VideoText::YELLOW_BACK" ref="ga1fd19b5b07308b98224e33d2b15ad168" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>YELLOW_BACK</b>&nbsp;&nbsp;&nbsp;(GREEN_BACK | RED_BACK)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga9432bc0e0317970ad6b3dea1555d9921"></a><!-- doxytag: member="VideoText::LIGHTGRAY_BACK" ref="ga9432bc0e0317970ad6b3dea1555d9921" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>LIGHTGRAY_BACK</b>&nbsp;&nbsp;&nbsp;(BLUE_BACK | GREEN_BACK | RED_BACK)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga1291f416b069313021b519eea62d5bf1"></a><!-- doxytag: member="VideoText::NORMAL" ref="ga1291f416b069313021b519eea62d5bf1" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___video_text.html#ga1291f416b069313021b519eea62d5bf1">NORMAL</a>&nbsp;&nbsp;&nbsp;(RED_FOREG | GREEN_FOREG | BLUE_FOREG)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">handy definition <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Descrição detalhada</h2>
<p>Video in text mode definitions </p>
<hr/><h2>Documentação das funções</h2>
<a class="anchor" id="ga5876c9f47ae08936a6634ecf22e09ea9"></a><!-- doxytag: member="video&#45;text.h::calcMemPosition" ref="ga5876c9f47ae08936a6634ecf22e09ea9" args="(int x, int y)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___user_types.html#ga718b4eb2652c286f4d42dc18a8e71a1a">ulong</a> calcMemPosition </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Calculate memory offset for writing at position x, y </p>

<p>Definido na linha <a class="el" href="#L5">5</a> do ficheiro <a class="el" href="">video-text.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00006"></a>00006 {
<a name="l00007"></a>00007         <span class="keywordflow">return</span> <a class="code" href="group___video_text.html#ga68707f77202e77a891e4f56e1f9b0219" title="Video address in text mode.">VIDEO_TEXT</a> + y * (<a class="code" href="group___video_text.html#ga241aeeb764887ae5e3de58b98f04b16d" title="Number of columns.">WIDTH</a> * 2) + x * 2;
<a name="l00008"></a>00008 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="gaf265e000b8df8f8ef7fc11b782a7c0ed"></a><!-- doxytag: member="video&#45;text.h::drawFrame" ref="gaf265e000b8df8f8ef7fc11b782a7c0ed" args="(char *title, char attributes, int x, int y, int width, int height)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a> drawFrame </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>title</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>attributes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>height</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Draw rectangular frame with left upper corner at position x,y with width and height dimensions, decorated with title attributes. return true if sucessfull </p>

<p>Definido na linha <a class="el" href="#L198">198</a> do ficheiro <a class="el" href="">video-text.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00199"></a>00199 {
<a name="l00200"></a>00200         <span class="keywordtype">int</span> x_fin = x + width - 1;
<a name="l00201"></a>00201         <span class="keywordtype">int</span> y_fin = y + height - 1;
<a name="l00202"></a>00202         
<a name="l00203"></a>00203         <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xC9, x, y, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;                  <span class="comment">//canto superior esquerdo</span>
<a name="l00204"></a>00204         <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xBB, x_fin, y, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;              <span class="comment">//canto superior direito</span>
<a name="l00205"></a>00205         <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xC8, x, y_fin, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;              <span class="comment">//canto inferior esquerdo</span>
<a name="l00206"></a>00206         <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xBC, x_fin, y_fin, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;  <span class="comment">//canto inferior direito</span>
<a name="l00207"></a>00207         
<a name="l00208"></a>00208         <span class="keywordtype">int</span> i = x + 1;
<a name="l00209"></a>00209         <span class="keywordflow">for</span>( ; i &lt; x_fin; i++)
<a name="l00210"></a>00210         {
<a name="l00211"></a>00211                 <a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xCD, i, y, attributes);                                            <span class="comment">//margem superior</span>
<a name="l00212"></a>00212                 <a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xCD, i, y_fin, attributes);                                        <span class="comment">//margem inferior       </span>
<a name="l00213"></a>00213         }
<a name="l00214"></a>00214         
<a name="l00215"></a>00215         i = y + 1;
<a name="l00216"></a>00216         <span class="keywordflow">for</span>( ; i &lt; y_fin; i++)
<a name="l00217"></a>00217         {
<a name="l00218"></a>00218                 <a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xBA, x, i, attributes);                                            <span class="comment">//margem esquerda</span>
<a name="l00219"></a>00219                 <a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0xBA, x_fin, i, attributes);                                        <span class="comment">//margem direita</span>
<a name="l00220"></a>00220         }
<a name="l00221"></a>00221         
<a name="l00222"></a>00222         <span class="comment">//verificar se o titulo cabe na moldura</span>
<a name="l00223"></a>00223         <span class="keywordtype">int</span> title_size = 0;
<a name="l00224"></a>00224         <span class="keywordflow">while</span>(title[title_size] != 0) title_size++;
<a name="l00225"></a>00225         <span class="keywordflow">if</span>(title_size &gt; width - 2) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00226"></a>00226         
<a name="l00227"></a>00227         <a class="code" href="group___video_text.html#ga0313826471a670c22f918e8f2321ed42">printStringAt</a>(title, x + 1, y + 1, attributes);                                 <span class="comment">//titulo</span>
<a name="l00228"></a>00228         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00229"></a>00229 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ga5077f8c181f7342c6bb640c65b4977a2"></a><!-- doxytag: member="video&#45;text.h::fillScreen" ref="ga5077f8c181f7342c6bb640c65b4977a2" args="(char background)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fillScreen </td>
          <td>(</td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>background</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Clear screen with background color </p>

<p>Definido na linha <a class="el" href="#L45">45</a> do ficheiro <a class="el" href="">video-text.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00046"></a>00046 {
<a name="l00047"></a>00047         <span class="keywordtype">int</span> i, j;
<a name="l00048"></a>00048         <span class="keywordflow">for</span>(i = 0; i &lt; <a class="code" href="group___video_text.html#ga241aeeb764887ae5e3de58b98f04b16d" title="Number of columns.">WIDTH</a>; i++)
<a name="l00049"></a>00049                 <span class="keywordflow">for</span>(j = 0; j &lt; <a class="code" href="group___video_text.html#gaed89bd71aee8be823e8a20ec4e093c1e" title="Number of rows.">HEIGHT</a>; j++)
<a name="l00050"></a>00050                         <a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(0, i, j, background);
<a name="l00051"></a>00051 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="gaa57acc96a0a70498025a2027fba89536"></a><!-- doxytag: member="video&#45;text.h::printCharAt" ref="gaa57acc96a0a70498025a2027fba89536" args="(char ch, int x, int y, char attributes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a> printCharAt </td>
          <td>(</td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>ch</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>attributes</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Print character ch at position x,y with attributes return true if sucessfull </p>

<p>Definido na linha <a class="el" href="#L32">32</a> do ficheiro <a class="el" href="">video-text.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00033"></a>00033 {
<a name="l00034"></a>00034         <span class="keywordflow">if</span>(x &lt; 0 || x &gt;= <a class="code" href="group___video_text.html#ga241aeeb764887ae5e3de58b98f04b16d" title="Number of columns.">WIDTH</a> || y &lt; 0 || y &gt;= <a class="code" href="group___video_text.html#gaed89bd71aee8be823e8a20ec4e093c1e" title="Number of rows.">HEIGHT</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00035"></a>00035         
<a name="l00036"></a>00036         _farsetsel(_dos_ds);
<a name="l00037"></a>00037         _farnspokeb(<a class="code" href="group___video_text.html#ga5876c9f47ae08936a6634ecf22e09ea9">calcMemPosition</a>(x, y), ch);
<a name="l00038"></a>00038         _farnspokeb(<a class="code" href="group___video_text.html#ga5876c9f47ae08936a6634ecf22e09ea9">calcMemPosition</a>(x, y) + 1, attributes);
<a name="l00039"></a>00039         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00040"></a>00040 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ga6a34b0b18d5e443e272a66262d15bb1a"></a><!-- doxytag: member="video&#45;text.h::printIntAt" ref="ga6a34b0b18d5e443e272a66262d15bb1a" args="(int num, int x, int y, char attributes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a> printIntAt </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>attributes</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Print integer num at position x,y with attributes. No C library function is used. return true if sucessfull </p>

<p>Definido na linha <a class="el" href="#L163">163</a> do ficheiro <a class="el" href="">video-text.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00164"></a>00164 {
<a name="l00165"></a>00165         <span class="keywordtype">int</span> i = 0;
<a name="l00166"></a>00166         
<a name="l00167"></a>00167         <span class="comment">//se o numero for negativo, imprimir &#39;-&#39;</span>
<a name="l00168"></a>00168         <span class="keywordflow">if</span>(num &lt; 0)
<a name="l00169"></a>00169         {
<a name="l00170"></a>00170                 <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(<span class="charliteral">&#39;-&#39;</span>, x, y, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00171"></a>00171                 i++;
<a name="l00172"></a>00172                 num = 0 - num;
<a name="l00173"></a>00173         }
<a name="l00174"></a>00174         
<a name="l00175"></a>00175         <span class="comment">//descobrir a ordem de grandeza do numero</span>
<a name="l00176"></a>00176         <span class="keywordtype">int</span> ordem = 1;
<a name="l00177"></a>00177         <span class="keywordflow">while</span>(num / ordem &gt;= 10) ordem *= 10;
<a name="l00178"></a>00178         
<a name="l00179"></a>00179         <span class="comment">//da esquerda para a direita, imprimir os algarismos</span>
<a name="l00180"></a>00180         <span class="keywordflow">while</span>(1)
<a name="l00181"></a>00181         {
<a name="l00182"></a>00182                 <span class="keywordtype">int</span> digito = num / ordem;
<a name="l00183"></a>00183                 <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(digito + 0x30, x + i, y, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00184"></a>00184                 num -= digito * ordem;
<a name="l00185"></a>00185                 <span class="keywordflow">if</span>(ordem == 1) <span class="keywordflow">break</span>;
<a name="l00186"></a>00186                 ordem /= 10;
<a name="l00187"></a>00187                 i++;
<a name="l00188"></a>00188         }
<a name="l00189"></a>00189 
<a name="l00190"></a>00190         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00191"></a>00191 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ga0313826471a670c22f918e8f2321ed42"></a><!-- doxytag: member="video&#45;text.h::printStringAt" ref="ga0313826471a670c22f918e8f2321ed42" args="(char *str, int x, int y, char attributes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___user_types.html#ga39db6982619d623273fad8a383489309">Bool</a> printStringAt </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>attributes</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Print character array str at position x,y with attributes return true if sucessfull </p>

<p>Definido na linha <a class="el" href="#L117">117</a> do ficheiro <a class="el" href="">video-text.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00118"></a>00118 {
<a name="l00119"></a>00119         <span class="keywordtype">int</span> i = 0;
<a name="l00120"></a>00120         <span class="keywordflow">while</span>(str[i] != 0)
<a name="l00121"></a>00121         {
<a name="l00122"></a>00122                 <span class="keywordflow">if</span>(!<a class="code" href="group___video_text.html#gaa57acc96a0a70498025a2027fba89536">printCharAt</a>(str[i], x + i, y, attributes)) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00123"></a>00123                 i++;
<a name="l00124"></a>00124         }
<a name="l00125"></a>00125                 
<a name="l00126"></a>00126         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00127"></a>00127 }
</pre></div></p>

</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Gerado em Tue Jun 1 22:04:49 2010 para FEUP-Defender por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
